import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
//import {Storage, LocalStorage} from 'ionic-angular';
import { Observable } from "rxjs/Observable";

import { HttpService } from "./HttpService";
import { StorageService } from "./StorageService";
/*
  用户访问后台的服务 
*/
@Injectable()
export class UserService {
  constructor(
    private http: Http,
    private httpService: HttpService,
    private storageService: StorageService
  ) { }
  /**
   *  用户注册
   */
  doRegister(param) {
    var url = "registerAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  // <<<<<<< .mine
  //   getAllToolsAPI() {
  //     var url = 'getAllToolsAPI';
  //     return this.httpService.httpGetNoAuth(url);
  //   }

  // ||||||| .r497
  // =======  

  /**美甲师拒绝店主 */
  artistRejectInvAPI(param) {
    var url = 'artistRejectInvAPI';
    return this.httpService.httpPostNoAuth(url, param);
  }

  /** 店主同意/拒绝美甲师申请*/
  shopRefuseArtistAPI(param) {
    var url = "shopRefuseArtistAPI";
    return this.httpService.httpPostNoAuth(url, param)
  }

  /**获取用户消息 */
  showMyMessageAPI(param) {
    var url = "showMyMessageAPI";
    return this.httpService.httpPostNoAuth(url, param)
  }
  /* 用户反馈*/
  feedBackAPI(param) {
    var url = 'feedBackAPI';
    return this.httpService.httpPostNoAuth(url, param)
  }

  /**获取所有类型，工具，材料，手法列表*/
  getAllToolsAPI() {
    var url = 'getAllToolsAPI';
    return this.httpService.httpGetNoAuth(url);
  }

  // >>>>>>> .r512
  /**用户找回密码，注册时候使用的接口 */
  doGetCaptchaAPI(param) {
    var url = "getCaptchaAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*密码找回界面 通过传入电话号码 和新密码 来修改密码*/
  resetPasswordAPI(param) {
    var url = "resetPasswordAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**获取验证码登录 */
  doLoginAPI(param) {
    var url = "loginAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**获取美甲店铺列表 */
  doGetTabBarShopsAPI(param) {
    var url = "getTabBarShopsAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**关注/取消关注 */
  dofocusAPI(param) {
    var url = "focusAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**店铺详情接口 */
  doGetShopNailListAPI(param) {
    var url = "getShopNailListAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**获取我的个人中心 */
  doMyInfoAPI(param) {
    var url = "myInfo";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**获取个人资料的信息 */
  doPersonalInfoAPI(param) {
    var url = "personalInfoAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**修改个人资料 */
  editUserInfoAPI(param) {
    var url = "editUserInfoAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**获取个人收获地址列表 */
  getAddressListAPI(param) {
    var url = "getAddressListAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**添加收获地址 */
  addAddressAPI(param) {
    var url = "addAddressAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**编辑地址 */
  editAddressAPI(param) {
    var url = "editAddressAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**删除地址 */
  delAddressAPI(param) {
    var url = "delAddressAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**设为默认地址 */
  editDefaultAddressAPI(param) {
    var url = "editDefaultAddressAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**消费者的购物车/待收货/待评价订单 */
  getMyOrderListAPI(param) {
    var url = "getMyOrderListAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  getUserCollectionAPI(param) {
    var url = "getUserCollectionAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**我的关注 */
  getUserFocusAPI(param) {
    var url = "getUserFocusAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**关注和取消关注 */
  focusAPI(param) {
    var url = "focusAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**批量取消收藏 */
  cancelCollectNailAPI(param) {
    var url = "cancelCollectNailAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**批量店铺订单*/
  shopOrderAPI(param) {
    var url = "shopOrderAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /** 获取评论 */
  checkShopCommentsAPI(param) {
    var url = "checkShopCommentsAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*获取购物车列表*/
  getMyCartListAPI(param) {
    var url = "getMyCartListAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*批量删除购物车*/
  cancelBuycarAPI(param) {
    var url = "delCartItemAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*获取粉丝*/
  getFans(param) {
    var url = "getUserFansAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*获取总的用户消息*/
  getMsg(param) {
    var url = "showMyMessageAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*修改阅读状态*/
  readMyMessageAPI(param) {
    var url = "readMyMessageAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*获取每一条消息详情*/
  showMessageDetailsAPI(param) {
    var url = "showMessageDetailsAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*修改购物车数量*/
  changeCartNumAPI(param) {
    var url = "changeCartNumAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**
   *会员修改用户密码
   */
  editPwdAPI(param) {
    var url = "editPwdAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**个人设置 */
  getSettingAPI(param) {
    var url = "getSettingAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /**个人设置 */
  uploadImgAPI(param) {
    var url = "uploadImg";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /**调用支付宝的支付 */
  editOrderAPI(param) {
    var url = "editOrderAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*美甲师上传美图 */
  artistUploadNailStyleAPI(param) {
    var url = "artistUploadNailStyleAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*美甲师上传美图 */
  uploadNailStyleFromArtistAPI(param) {
    var url = "uploadNailStyleFromArtistAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*通过传入 服务的 service_id 得到店铺的信息*/
  getShopInfoByServiceIdAPI(param) {
    var url = "getShopInfoByServiceIdAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*通过传入 美甲师的 artist_id  和 user_id 来得到 美甲师的信息*/
  getArtistDetailsAPI(param) {
    var url = "getArtistDetailsAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*通过传入 店铺的 shop_id  和 支付类型  pay_type 支付类型（1 代金卷 2 支付宝）  来生成订单号*/
  // generateBondOrderAPI(param) {
  // 	var url = 'generateBondOrderAPI';
  // 	return this.httpService.httpPostNoAuth(url, param);
  // }

  /*使用优惠券支付 店铺保证金*/
  // payShopBondAPI(param) {
  // 	var url = 'payShopBondAPI';
  // 	return this.httpService.httpPostNoAuth(url, param);
  // }
  /*评论回复 */
  postUserT(param) {
    var url = "publishArticleCommentAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*通过传入 店铺的 shop_id  和 支付类型  pay_type 支付类型（1 代金卷 2 支付宝）  来生成订单号*/
  //   generateBondOrderAPI(param){
  //     var url = 'generateBondOrderAPI';
  //     return this.httpService.httpPostNoAuth(url,param);
  //   }

  /*使用优惠券支付 店铺保证金*/
  //   payShopBondAPI(param){
  //       var url = "payShopBondAPI";
  //       return this.httpService.httpPostNoAuth(url,param);
  //   }
  
  /*通过传入 店铺的 shop_id  和 支付类型  pay_type 支付类型（1 代金卷 2 支付宝）  来生成订单号*/
  generateBondOrderAPI(param) {
    var url = "generateBondOrderAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  
  /*使用优惠券支付 店铺保证金*/
  payShopBondAPI(param) {
    var url = "payShopBondAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  
  //消费者申请退款
  userRefundAPI(param) {
    var url = "userRefundAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*消费者支出*/
  userPayListAPI(param){
	  var url="userPayListAPI";
	  return this.httpService.httpPostNoAuth(url,param);
  }
  //消费者订单详情
  userOrderInfoAPI(param){
	  var url="userOrderInfoAPI";
	  return this.httpService.httpPostNoAuth(url,param);
  }
  /*生成二维码 */
  setQrCodeAPI(param) {
    var url = "setQrCodeAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }

  /*服务上下架*/
  operateShelfAPI(param) {
    var url = "operateShelfAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*二维码扫描成功*/
  getQrCodeAPI(param) {
    var url = "getQrCodeAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
  /*输入劵码成功*/
  inputPayCodeAPI(param) {
    var url = "inputPayCodeAPI";
    return this.httpService.httpPostNoAuth(url, param);
  }
    /**店铺退回保证金 */
    refundBondAPI(param) {
      var url = "refundBondAPI";
      return this.httpService.httpPostNoAuth(url, param);
    }
    /*获取新版本号*/
    checkVersionAPI(param){
      var url = "checkVersionAPI";
      return this.httpService.httpPostNoAuth(url, param);
    }
}
